package com.dareway.thread;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Thread_paralleStream {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>(Arrays.asList(1, 4, 5, 2, 9, 3, 6, 0));
        list
                .parallelStream()    //获得并行流
//                .forEach(i -> System.out.println(Thread.currentThread().getName() + " -> " + i));
                .forEachOrdered(System.out::println); //维持正常顺序
    }
}
